//文本就绪事件

console.log("js调试");





var fixed=document.getElementById('fixed');
var static=document.getElementById("static");

var yy=static.offsetTop+60;





//往下滑动自动跳出2号导航栏
var show=function(){

	fixed.classList.add("active");
}


var hide=function(){
	fixed.classList.remove("active");
}



window.addEventListener("scroll",function(){//添加窗口事件，事件类型为scroll窗口滑动事件

	if(window.scrollY>yy){
		show();
	}else{
		hide();
	}
})


//自动滑动功能
var positionY=0;
var timer=window.setInterval(function(){

	positionY+=1;
	if(positionY<=static.offsetTop){
		window.scrollTo(0,positionY);//当positionY的距离小于static.offsetTop的值时它就自增1
	}else{
		clearInterval(timer);
	}
})






















